package edu.whut.mall.pojo.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import edu.whut.mall.common.enums.FileType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
/**
 * Author: smq
 * Unit: D9lab
 * Date: 2021-06-07 16:15
 */
@Data
@Builder
@AllArgsConstructor
public class File implements Serializable {
    private static final long serialVersionUID = 2;

    @TableId(type = IdType.AUTO)
    private Integer id;
    private String url;
    private Date createTime;
    private Boolean isDeleted;
    private FileType type;

    public File() {
        this.createTime = new Date();
    }

    public File(String url, Date createTime, boolean isDeleted) {
        this.url = url;
        this.createTime = createTime;
        this.isDeleted = isDeleted;
        this.type = FileType.图片;
    }

    public File(String url, Date createTime, boolean isDeleted, FileType type) {
        this.url = url;
        this.createTime = createTime;
        this.isDeleted = isDeleted;
        this.type = type;
    }

}
